#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
const int N = 1e6 + 10;
const ll mod = 1e9 + 7;
ll a[N], s[N];

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    ll n; cin >> n;
    if (n >= 8192) {
        cout << 0 << endl;
        return 0;
    }
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        s[i] = s[i - 1] ^ a[i];
    }
    ll ans = 1;
    for (int i = 1; i <= n; i++) {
        for (int j = i; j <= n; j++) {
            ans = (ans * (s[j] ^ s[i - 1])) % mod;
        }
    }
    cout << ans << endl;
    return 0;
}